﻿using com.guojin.core.io;
using com.guojin.core.io.message;
using System.Collections.Generic;

namespace com.guojin.mj.net.message.login
{
    //登录结果
    public class LoginRet : Message
    {
        public static int TYPE = 7;
        public static int ID = 10;

        public int id { get; set; }
        public string name { get; set; }
        public string openId { get; set; }                  //用不到，暂时不动
        public string uuid { get; set; }                       //用不到，暂时不动
        public string avatar { get; set; }
        public int sex { get; set; }                              //0：女生，1：男生，2 ：未知

        public string roomCheckId { get; set; }        //如果用户在房间内返回房间id，否则“”；
        public int gold { get; set; }
        public string token { get; set; }
        public string ip { get; set; }
        public int level { get; set; }                          //代理等级
        public List<OptionEntry> clubList { get; set; }
        public List<OptionEntry> lianMengList { get; set; }
        public int zhuan { get; set; }


        public void decode(Input _in)
        {
            id = _in.readInt();
            name = _in.readString();
            openId = _in.readString();
            uuid = _in.readString();
            avatar = _in.readString();
            sex = _in.readInt();
            roomCheckId = _in.readString();
            token = _in.readString();
            level = _in.readInt();
            gold = _in.readInt();

            clubList = new List<OptionEntry>();
            int len2 = _in.readInt();
            if (len2 > 0)
            {
                for (int i = 0; i < len2; i++)
                {
                    var op = new OptionEntry();
                    op.decode(_in);
                    clubList.Add(op);
                }
            }

            lianMengList = new List<OptionEntry>();
            int len = _in.readInt();
            if (len > 0)
            {
                for (int i = 0; i < len ; i++)
                {
                    var op = new OptionEntry();
                    op.decode(_in);
                    lianMengList.Add(op);
                }
            }

            zhuan = _in.readInt();
        }

        public void encode(Output _out)
        {
        }

        public int getMessageId()
        {
            return ID;
        }

        public int getMessageType()
        {
            return TYPE;
        }

        public string toString()
        {
            return "LoginRet [id=" + id + ",name=" + name + ",openId=" + openId + ",uuid=" + uuid + ",avatar=" + avatar +
                   ",sex=" + sex + ",roomCheckId=" + roomCheckId + ",gold=" + gold + ",token=" + token +
                    "level =" + level + ", ]";
        }
    }
}